package org.come.Jpanel;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import com.tool.btn.CommonBtn;
import com.tool.btn.TextBtn;
import com.tool.tcpimg.UIUtils;

/**
 * 累充面板
 * 
 * @author zeng
 * 
 */
public class CumulativeJpanel extends JPanel {

	// 上一页 , 下一页 按钮
	private CommonBtn upPage, downPage;
	// 首页 , 末页
	private TextBtn shouYe, moYe, receive;

	private int maxPage = 1; // 最大页码
	private int nowpage = 1; // 当前页数
	// 放置当前页数和总页数
	private JLabel labpage;
	// 进度条
	private JLabel jinduTiao, jinduTiaoVal, jinduText;

	private FundBuyGoodsJpanel[] detail = new FundBuyGoodsJpanel[12];

	public CumulativeJpanel() {
		// TODO Auto-generated constructor stub
		this.setPreferredSize(new Dimension(656, 445));
		this.setOpaque(false);
		this.setLayout(null);

		// 放置当前页数和总页数
		labpage = new JLabel(nowpage + "/" + maxPage, SwingConstants.CENTER);
		labpage.setForeground(Color.white);
		labpage.setBounds(335, 378, 58, 17);
		labpage.setFont(UIUtils.TEXT_FONT1);
		this.add(labpage);

		// 上一页 (caozuo = 4)
		upPage = new CommonBtn("skin/8100226/button/10.png", 1, "", 4);
		upPage.setBounds(315, 379, 18, 18);

		// 下一页 (caozuo = 5)
		downPage = new CommonBtn("skin/8100226/button/9.png", 1, "", 5);
		downPage.setBounds(397, 379, 18, 18);

		// 首页 (caozuo = 1)
		shouYe = new TextBtn("skin/8100226/button/2.png", 1, "首页", 1);
		shouYe.setBounds(280, 379, 34, 17);

		// 末页 (caozuo = 2)
		moYe = new TextBtn("skin/8100226/button/2.png", 1, "末页", 2);
		moYe.setBounds(415, 379, 34, 17);

		for (int i = 0; i < detail.length; i++) {
			detail[i] = new FundBuyGoodsJpanel();
			int row = i / 3;
			int rank = i % 3;
			detail[i].setOpaque(false);
			detail[i].setBounds(rank * 185 + 77, 115 + row * 60, 178, 48);
			this.add(detail[i]);
		}

		jinduText = new JLabel();
		jinduText.setText("当前进度: ");
		jinduText.setFont(UIUtils.TEXT_HY19);
		jinduText.setBounds(75, 50, 120, 15);
		this.add(jinduText);

		jinduTiaoVal = new JLabel();
		ImageIcon jinduVal = new ImageIcon("skin/8100226/button/27.png");
		// ImageIcon jinduVal = CutButtonImage.getImage("skin/8100226/button/27.png",
		// 0, 0);
		jinduTiaoVal.setIcon(jinduVal);
		jinduTiaoVal.setBounds(177, 50, 148, 15);
		jinduTiaoVal.setOpaque(false);
		this.add(jinduTiaoVal);

		jinduTiao = new JLabel();
		ImageIcon jindu = new ImageIcon("inkImg/old/background/55.png");
		jinduTiao.setIcon(jindu);
		jinduTiao.setBounds(175, 50, 148, 15);
		this.add(jinduTiao);

		// 累充奖励领取
		// receive = new TextBtn("skin/8100226/button/2.png", 1, "领取", 5);
		// receive.setBounds(350, 50, 34, 17);
		// this.add(receive);

		this.add(upPage);
		this.add(downPage);
		this.add(shouYe);
		this.add(moYe);
	}

	private ImageIcon iconBack;

	@Override
	public void paintComponent(Graphics g) {
		// TODO Auto-generated method stub
		super.paintComponent(g);
		if (iconBack == null) {
			iconBack = new ImageIcon("inkImg/old/background/53.png");
		}
		g.drawImage(iconBack.getImage(), 53, 32, 600, 340, this);
	}

	public CommonBtn getUpPage() {
		return upPage;
	}

	public void setUpPage(CommonBtn upPage) {
		this.upPage = upPage;
	}

	public CommonBtn getDownPage() {
		return downPage;
	}

	public void setDownPage(CommonBtn downPage) {
		this.downPage = downPage;
	}

	public TextBtn getShouYe() {
		return shouYe;
	}

	public void setShouYe(TextBtn shouYe) {
		this.shouYe = shouYe;
	}

	public TextBtn getMoYe() {
		return moYe;
	}

	public void setMoYe(TextBtn moYe) {
		this.moYe = moYe;
	}

	public TextBtn getReceive() {
		return receive;
	}

	public void setReceive(TextBtn receive) {
		this.receive = receive;
	}

	public int getMaxPage() {
		return maxPage;
	}

	public void setMaxPage(int maxPage) {
		this.maxPage = maxPage;
	}

	public int getNowpage() {
		return nowpage;
	}

	public void setNowpage(int nowpage) {
		this.nowpage = nowpage;
	}

	public JLabel getLabpage() {
		return labpage;
	}

	public void setLabpage(JLabel labpage) {
		this.labpage = labpage;
	}

	public JLabel getJinduTiao() {
		return jinduTiao;
	}

	public void setJinduTiao(JLabel jinduTiao) {
		this.jinduTiao = jinduTiao;
	}

	public JLabel getJinduTiaoVal() {
		return jinduTiaoVal;
	}

	public void setJinduTiaoVal(JLabel jinduTiaoVal) {
		this.jinduTiaoVal = jinduTiaoVal;
	}

	public JLabel getJinduText() {
		return jinduText;
	}

	public void setJinduText(JLabel jinduText) {
		this.jinduText = jinduText;
	}

	public FundBuyGoodsJpanel[] getDetail() {
		return detail;
	}

	public void setDetail(FundBuyGoodsJpanel[] detail) {
		this.detail = detail;
	}

	public ImageIcon getIconBack() {
		return iconBack;
	}

	public void setIconBack(ImageIcon iconBack) {
		this.iconBack = iconBack;
	}

}
